#include<stdio.h>

int is_ry(int n)
{
	if (n % 4 == 0 && n % 100 != 0 || n % 400 == 0)
	{
		return 1;
	}
	return 0;
}

int main()
{
	int year = 0;
	for (year = 1000; year <= 2000; year++)
	{
		if (is_ry(year) == 1)
		{
			printf("%d ", year);
		}
	}
	return 0;
}